<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
<html>
<head>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<title>Exported from Notepad++</title>
<style type="text/css">
span {
	font-family: 'Courier New';
	font-size: 10pt;
	color: #000000;
}
.sc0 {
}
.sc2 {
	font-style: italic;
	color: #0000FF;
}
.sc4 {
	color: #8000FF;
}
.sc5 {
	font-weight: bold;
	font-style: italic;
	color: #0000FF;
}
.sc6 {
	font-weight: bold;
	color: #008000;
}
.sc8 {
	font-weight: bold;
	font-style: italic;
	color: #008000;
}
.sc10 {
	font-weight: bold;
	color: #0080FF;
}
.sc11 {
}
.sc14 {
	color: #8080FF;
}
</style>
</head>
<body>
<div style="float: left; white-space: pre; line-height: 1; background: #FFFFFF; "><span class="sc2">// ================================================== //</span><span class="sc0">
</span><span class="sc2">// ============ TUTORIELS BEBOP 1.0 ================= //</span><span class="sc0">
</span><span class="sc2">// ================================================== //</span><span class="sc0">

</span><span class="sc2">// Synthèse de circuit combinatoire avec bopbdd</span><span class="sc0">
</span><span class="sc2">// Net-list de test de la synthèse ROM et bopbdd de la division</span><span class="sc0">

</span><span class="sc2">// Une possibilité : bopbdd</span><span class="sc0">
</span><span class="sc2">// On inclu le bloc macro-généré par bopbdd à partir de l'image rom</span><span class="sc0">
</span><span class="sc10">#</span><span class="sc5">include</span><span class="sc0"> </span><span class="sc14">"div.bop"</span><span class="sc0">

</span><span class="sc2">// Et celui généré à partir de l'image étoilée</span><span class="sc0">
</span><span class="sc10">#</span><span class="sc5">include</span><span class="sc0"> </span><span class="sc14">"div_opt.bop"</span><span class="sc0">

</span><span class="sc10">#</span><span class="sc5">define</span><span class="sc0"> </span><span class="sc8">N</span><span class="sc0"> </span><span class="sc4">4</span><span class="sc0">

</span><span class="sc2">// Une deuxième option : on utilise une ROM initialisee avec </span><span class="sc0">
</span><span class="sc2">// la table de vérité macro-générée plus tot (lookup table)</span><span class="sc0">
</span><span class="sc5">ROM</span><span class="sc0"> </span><span class="sc11">div</span><span class="sc0"> </span><span class="sc10">(</span><span class="sc4">8</span><span class="sc10">,</span><span class="sc0"> </span><span class="sc4">4</span><span class="sc10">)</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc5">file</span><span class="sc0"> </span><span class="sc10">(</span><span class="sc14">"div.ascii"</span><span class="sc10">)</span><span class="sc0">

</span><span class="sc5">external</span><span class="sc0"> </span><span class="sc11">div</span><span class="sc0"> </span><span class="sc14">"./div.bpox -N $(N)"</span><span class="sc0">

</span><span class="sc8">DivCheck</span><span class="sc0"> </span><span class="sc10">()</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc10">(</span><span class="sc11">s_reference</span><span class="sc10">:[</span><span class="sc4">4</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc11">s_rom</span><span class="sc10">:[</span><span class="sc4">4</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc11">s_bdd</span><span class="sc10">:[</span><span class="sc4">4</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc11">s_bdd_etoile</span><span class="sc10">:[</span><span class="sc4">4</span><span class="sc10">])</span><span class="sc0">
</span><span class="sc5">where</span><span class="sc0">
    </span><span class="sc2">// On utilise le compteur générique counter.bpix</span><span class="sc0">
    </span><span class="sc2">// situé dans $BEBOPDIR/bin pour générer l'entrée</span><span class="sc0">
    </span><span class="sc5">for</span><span class="sc0"> </span><span class="sc8">N2</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc4">2</span><span class="sc0"> </span><span class="sc11">*</span><span class="sc0"> </span><span class="sc8">N</span><span class="sc0">  
        </span><span class="sc11">a</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc11">b</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc6">pipe</span><span class="sc10">(</span><span class="sc14">"counter.bpix -N $(N2)"</span><span class="sc10">);</span><span class="sc0">
    </span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">for</span><span class="sc10">;</span><span class="sc0">

    </span><span class="sc2">// On calcule les résultats pour chaque possibilité</span><span class="sc0">
    </span><span class="sc11">s_reference</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc10">$</span><span class="sc11">div</span><span class="sc10">(</span><span class="sc11">a</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc11">b</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">]);</span><span class="sc0">
    </span><span class="sc11">s_rom</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc8">rom_div</span><span class="sc10">(</span><span class="sc11">a</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc11">b</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">]);</span><span class="sc0">              </span><span class="sc2">// lookup-table</span><span class="sc0">
    </span><span class="sc11">s_bdd</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc8">Div</span><span class="sc10">.</span><span class="sc8">Bloc</span><span class="sc10">(</span><span class="sc11">a</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc11">b</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">]);</span><span class="sc0">             </span><span class="sc2">// bdd optimisé</span><span class="sc0">
    </span><span class="sc11">s_bdd_etoile</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">]</span><span class="sc0"> </span><span class="sc10">=</span><span class="sc0"> </span><span class="sc8">Div_opt</span><span class="sc10">.</span><span class="sc8">Bloc2</span><span class="sc10">(</span><span class="sc11">a</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc11">b</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">]);</span><span class="sc0"> </span><span class="sc2">// bdd optimisé avec etoile</span><span class="sc0">

    </span><span class="sc2">// On teste unitairement ces résultats avec le bloc externe de référence</span><span class="sc0">
    </span><span class="sc10">$</span><span class="sc11">div</span><span class="sc10">.</span><span class="sc6">test</span><span class="sc10">(</span><span class="sc11">a</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc11">b</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc11">s_rom</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">]);</span><span class="sc0">
    </span><span class="sc10">$</span><span class="sc11">div</span><span class="sc10">.</span><span class="sc6">test</span><span class="sc10">(</span><span class="sc11">a</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc11">b</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc11">s_bdd</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">]);</span><span class="sc0">
    </span><span class="sc10">$</span><span class="sc11">div</span><span class="sc10">.</span><span class="sc6">test</span><span class="sc10">(</span><span class="sc11">a</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc11">b</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">],</span><span class="sc0"> </span><span class="sc11">s_bdd_etoile</span><span class="sc10">:[</span><span class="sc8">N</span><span class="sc10">]);</span><span class="sc0">

</span><span class="sc5">end</span><span class="sc0"> </span><span class="sc5">where</span><span class="sc10">;</span><span class="sc0">
</span></div></body>
</html>
